import { useIntersectionObserver } from '@vueuse/core'
export const lazyPlugs = {
    install(app){
        app.directive('img-lazy',{
            //el 指令绑定的元素
            //binding 指令等于号后面绑定的值
            mounted(el,banding){
                const{stop} = useIntersectionObserver(el,([{isIntersecting}])=>{
                    if(isIntersecting){
                        el.src = banding.value
                        stop()
                    }
                })
                }
            }
        )
    }
}